tests/int/hooks: fix failed hooks test#4352
Closed
kolyshkin wants to merge 1 commit intoopencontainers:mainfrom
Closed
tests/int/hooks: fix failed hooks test#4352kolyshkin wants to merge 1 commit intoopencontainers:mainfrom
kolyshkin wants to merge 1 commit intoopencontainers:mainfrom
Conversation
When reviewing PR 4348, I noticed that it removed the call to parent.terminate when a hook has failed. Yet, this test case did not catch that issue. Add the check that the container was never fully started after a hook failure. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
rata
reviewed
Jul 18, 2024
Comment on lines
+43
to
+44
| # Check the container was never started. | ||
| runc delete "test_hook-$hook" |
Member
There was a problem hiding this comment.
Can you clarify here what happens that the container status is not 0 but can be started anyways? I mean clarify in the comment. As it doesn't seem intuitive :-)
Contributor
Author
There was a problem hiding this comment.
OK I rechecked and this PR does not test the issue it's supposed to test.
IOW, with the terminate code removed, like this:
diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go
index 6a91df01..c6883c56 100644
--- a/libcontainer/container_linux.go
+++ b/libcontainer/container_linux.go
@@ -360,9 +360,6 @@ func (c *Container) start(process *Process) (retErr error) {
}
if err := c.config.Hooks.Run(configs.Poststart, s); err != nil {
- if err := ignoreTerminateErrors(parent.terminate()); err != nil {
- logrus.Warn(fmt.Errorf("error running poststart hook: %w", err))
- }
return err
}
}It does not fail. I'm not quite sure why, but obviously this PR is useless.
Member
Without #4348 , another missing parent.terminate mentioned in #4355 : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When reviewing PR #4348, I noticed that it removed the call to parent.terminate when a hook has failed. Yet, this test case did not catch that issue.
Add the check that the container was never fully started after a hook failure.